package com.common.base.app.activity

import com.common.base.app.viewmodel.ListViewModel
import com.common.base.databinding.BaseRecylerBinding
import com.common.base.widget.PlaceholderView

/**
 * 列表基类
 */
abstract class BaseRecyclerActivity<VM : ListViewModel<K>, K> :
    BaseRecyclerVMActivity<BaseRecylerBinding, VM, K>() {

    override fun getViewContentBinding() = BaseRecylerBinding.inflate(layoutInflater)

    //占位控件
    override fun getPlaceholderView(): PlaceholderView? = mViewBinding.mPlaceholderView

    override fun getHeadLayout() = mViewContentBinding.headLayout
    override fun getContentLayout() = mViewContentBinding.contentLayout

    override fun initEvents() {
        setErrorRetryListener { autoRefresh() }
    }

    override fun getIRecyclerView() = mViewContentBinding.mtRecyclerView
}